/*
 * Group 3, User Interface Programming II (vt11)
 * Pooya | Flora | Monica | Can
 */
package vical.view;

import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;

/**
 * The left Panel of the main window: 
 * contains categories and a mini-Calendar used to navigate.
 * 
 * Also contains a ComboBox for highlighting day cards under a certain category.
 *
 * @author Can
 * @author Monica
 */
public class LeftPanel extends JPanel {

    private MiniCal miniCal;
    private CategoryPanel categoryPanel;
    private DayCardHighlightPanel highlightDayCard;
    private JPanel southPanel;
    private MainWindow mainWindow;
    private Color catColor = new Color(235, 235, 235);

    public LeftPanel(MainWindow mainWindow) {
        this.mainWindow = mainWindow;
        initComponents();
    }

    private void initComponents() {
        // mini calendar
        miniCal = new MiniCal(mainWindow.getViewPanel());
        // categories
        categoryPanel = new CategoryPanel(mainWindow.getViewPanel());
        categoryPanel.setBackground(catColor);
        // highlightDayCard
        highlightDayCard = new DayCardHighlightPanel(mainWindow.getViewPanel());
        southPanel = new JPanel();
        southPanel.setBorder(new LineBorder(Color.LIGHT_GRAY, 1));
//        southPanel.setBackground(Color.DARK_GRAY);
        southPanel.setLayout(new BorderLayout());
        southPanel.add(BorderLayout.CENTER, highlightDayCard);

        this.setLayout(new BorderLayout());
        this.add(BorderLayout.NORTH, miniCal);
        this.add(BorderLayout.CENTER, categoryPanel);
        this.add(BorderLayout.SOUTH, southPanel);
    }

    public void refresh() {
        highlightDayCard.updateCategory();
        categoryPanel.refresh();
    }

    public MiniCal getMiniCal() {
        return miniCal;
    }
}
